package com.wefans.wefansapp.common.tool.popup;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.wefans.wefansapp.R;

public class FindAllIdDialog extends BaseDialog {

	private Button mBtnClose = null;
	private EditText mEtName = null;
	private EditText mEtNickName = null;
	private EditText mEtEmail = null;
	private Button mBtnSendIdEmail = null;	
	
	private OnFindAllIdListener mFindAllIdListener = null;
	
	public interface OnFindAllIdListener {
		void onSendIdEmail(String strNeme, String strNickname, String strEmail);		
	}
	
	public FindAllIdDialog(Context mContext, OnFindAllIdListener findAllIdListener) {
		super(mContext);
		
		setContentView(R.layout.dialog_find_all_id);
		
		mBtnClose = (Button)findViewById(R.id.BTN_DIALOG_CLOSE);
		mEtName = (EditText)findViewById(R.id.ET_NAME);
		mEtNickName = (EditText)findViewById(R.id.ET_NICKNAME);
		mEtEmail = (EditText)findViewById(R.id.ET_EMAIL);
		mBtnSendIdEmail = (Button)findViewById(R.id.BTN_SEND_ID_EMAIL);		
		
		mFindAllIdListener = findAllIdListener;
		mBtnClose.setOnClickListener(onClickListener);
		mBtnSendIdEmail.setOnClickListener(onClickListener);
	}

	android.view.View.OnClickListener onClickListener = new android.view.View.OnClickListener() {
		
		public void onClick(View v) {
			
			switch (v.getId()) {
			case R.id.BTN_SEND_ID_EMAIL:
				String strName = mEtName.getText().toString();
				String strNickname = mEtNickName.getText().toString();
				String strEmail = mEtEmail.getText().toString();
				
				if (strName == null || strName.length() <= 0||
					strNickname == null || strNickname.length() <= 0 ||
					strEmail == null || strEmail.length() <= 0) {
					return;
				}
				
				if (mFindAllIdListener != null) {
					mFindAllIdListener.onSendIdEmail(strName, strNickname, strEmail);
				}
				dismiss();
				break;
			case R.id.BTN_DIALOG_CLOSE:
				dismiss();
				break;
			}
		}
	};

}
